package objectoriented1;
/*
测试商品类

创建一个而商品类的对象，调用对象的方法，进行测试
 */
public class TestGoods {
    public static void main(String[] args) {
        //类的静态成员已经存在,类名.静态成员
        System.out.println(Goods.shopName);

        //创建对象
        int a=8;
        Goods goods_1=new Goods();
        Goods goods_2=new Goods();
        Goods goods_3=new Goods();
        System.out.println(goods_1.getShopName());

        //Goods goods_2=new Goods("1002","话筒",45);
        //使用对象
        //对象名.属性
        //goods_1.goodsCode="1001";
        //goods_1.goodsName="book";
        //goods_1.goodsPrice=-4.1;//操作失误，导致一个不可能的数据
        goods_1.setGoodsPrice(-4.1);
        goods_1.setGoodsName("话筒");
        goods_1.setShopName("mini2元店");
        goods_2.setShopName("mini2元店  ");
        goods_3.setShopName("2元店");
        System.out.println("商品1的价格："+goods_1.getGoodsPrice());
        //对象名.方法
        goods_1.show();

    }
}
